import mockJs from "mockjs";

interface UserData {
  id: number;
  name: string;
  age: number;
  gender: string;
  avatar: string;
  date: string;
}

interface User {
  code: number;
  data: UserData;
  message: string;
}
const userList = mockJs.mock({
  "data|100": [
    {
      "id|+1": 1,
      name: "@cname",
      "age|18-30": 1,
      "gender|1": ["男", "女"],
      avatar:
        "https://cdn.jsdelivr.net/gh/itclanCoder/pic-bed/202211021630838.png",
      date: '@date("yyyy-MM-dd")',
    },
  ],
});
module.exports = [
  {
    method: "GET",
    url: "/api/getUser",
    response: (): User => {
      return {
        code: 200,
        data: userList.data,
        message: "success",
      };
    },
  },
];
